package cn.liontalk.CompositePattern.unnormal;

import java.util.LinkedList;
import java.util.List;

public class Manager {




    private String name;
    private List<Leader> leaders;

    public Manager(String name) {
        this.name = name;
        this.leaders = new LinkedList<>();
    }

    public void add(Leader leader) {
        this.leaders.add(leader);
    }

    public void remove(Leader leader) {
        this.leaders.remove(leader);
    }

    public void display(int index) {
        for (int i = 0; i < index; i++) {
            System.out.print("----");
        }
        System.out.println("经理：" + this.name);
        leaders.forEach(leader -> {
            leader.display(index+1);
        });
    }
}
